/*
** fill_struct.c for rt in /home/le_e//project/project_b2/raytracer
** 
** Made by canh-kiet le
** Login   <le_e@epitech.net>
** 
** Started on  Sat Apr 28 17:32:05 2012 canh-kiet le
** Last update Mon Apr 30 21:18:04 2012 canh-kiet le
*/

#include	"rt.h"

void		fill_eye(t_scene *sc, char **tab, int ind)
{
  void		(*eye_ptr[4])(char **, t_scene *, int);

  check_params(ind, tab, sc->line_err);
  eye_ptr[0] = eye_res;
  eye_ptr[1] = eye_oeil;
  eye_ptr[2] = eye_rot;
  eye_ptr[3] = eye_fov;
  eye_ptr[ind](tab, sc, sc->line_err);
}

void		fill_lgt(t_lgt *lgt, char **tab, int ind, int err_line)
{
  void		(*lgt_ptr[5])(char **, t_lgt *, int);
  int		i;

  i = 0;
  lgt_ptr[0] = lgt_pos;
  lgt_ptr[1] = lgt_rot;
  lgt_ptr[2] = lgt_mode;
  lgt_ptr[3] = lgt_color;
  lgt_ptr[4] = lgt_intens;
  while (!lgt[i].end)
    i++;
  lgt_ptr[ind](tab, &lgt[i], err_line);
}

void		fill_obj(t_obj *obj, char **tab, int ind, int err_line)
{
  void		(*obj_ptr[10])(char **, t_obj *, int);
  int		i;

  i = 0;
  obj_ptr[0] = obj_pos;
  obj_ptr[1] = obj_rot;
  obj_ptr[2] = obj_lim;
  obj_ptr[3] = obj_data;
  obj_ptr[4] = obj_n_ref;
  obj_ptr[5] = obj_shiness;
  obj_ptr[6] = obj_color;
  obj_ptr[7] = obj_transm;
  obj_ptr[8] = obj_absorb;
  obj_ptr[9] = obj_reflec;
  while (!obj[i].end)
    i++;
  obj_ptr[ind](tab, &obj[i], err_line);
}
